package com.yc.spring.bank;

import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;

import javax.servlet.ServletException;

public class WebConfig implements WebApplicationInitializer {
    @Override
    public void onStartup(javax.servlet.ServletContext servletContext) throws ServletException {
        System.out.println("Load Spring web application configuration");
        AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
        context.register(JdbcConfig.class);
        servletContext.setInitParameter("contextConfigLocation","classpath:beans.xml");
        servletContext.addListener(ContextLoaderListener.class);
    }
}
